﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ANMCMaster.Master" AutoEventWireup="true" CodeBehind="Blogger.aspx.cs" Inherits="AllNations.UI.Blogger" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ANHeaderContent" runat="server">
    <script language="javascript">
        function openModalWindow(title, url, width, height) {
            var popup = radopen(null, "Window1");
            popup.SetWidth(width);
            popup.SetHeight(height);
            popup.SetModal(true);
            popup.SetTitle(title);
            popup.SetUrl(url);
            return false;
        }

        function CreateEntry() {
            // width: 780; height: 585
            return openModalWindow("New blog entry", "/UI/BlogManager.aspx?View=CreateBlog&HtmlPageId=" + GetCurrentHtmlPageId(), 820, 600);
        }

        function EditBlog(blogId) {
            return openModalWindow("Edit blog entry", "/UI/BlogManager.aspx?View=EditBlog&HtmlPageId=" + GetCurrentHtmlPageId() + "&BlogId=" + blogId, 820, 600);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ANBodyContent" runat="server">
    <article class="node static-page content">
        <asp:Repeater ID="rptBloggerEntries" runat="server">
            <HeaderTemplate>
                <asp:Panel ID="panelAdminMenu" runat="server" Visible='<%# IsPageAdministrator() %>' style="float: right; padding: 10px 0px;">
                    <div style="float: left"><asp:HyperLink ID="lnkCreateBlog" runat="server" NavigateUrl="javascript:void(0);" onclick="CreateEntry();">
                        <asp:Image runat="server" ImageUrl="~/Images/plus-icon.png" ImageAlign="AbsMiddle" style="float: left" />&nbsp;New entry</asp:HyperLink>
                    </div>
                </asp:Panel>
            </HeaderTemplate>
            <ItemTemplate>
                <div style="clear: both;"></div>
                <div style="margin: 15px 0px;">
                    <div style="float: left">
                        <asp:Label runat="server" CssClass="BlogDate" Text='<%# Eval("create_dttm","{0:dddd, MMMM d, yyyy}") %>' />
                    </div>
                    <div style="float: right">
                        <div style="float: left"><asp:HyperLink runat="server" NavigateUrl="javascript:void(0);" onclick='<%# string.Format(@"EditBlog(""{0}"")", Eval("blog_id")) %>' Visible='<%# IsPageAdministrator() %>'><asp:Image runat="server" ImageUrl="~/Images/edit.gif" ImageAlign="AbsMiddle" style="float: left" />&nbsp;Edit</asp:HyperLink></div>
                        <div style="float: left"><asp:Label runat="server" Visible='<%# IsPageAdministrator() %>' style="margin: 0px 10px;">|</asp:Label></div>
                        <div style="float: left"><asp:LinkButton ID="btDeleteBlog" runat="server" CommandArgument='<%# Eval("blog_id") %>' OnClientClick="if (!confirm('You are about to delete a blog entry, click OK to continue.')) return false;" OnClick="btDeleteBlog_Click"><asp:Image runat="server" ImageUrl="~/Images/delete.gif" ImageAlign="AbsMiddle" style="float: left" />&nbsp;Delete</asp:LinkButton></div>
                    </div>
                    <div style="clear: both;"></div>
                    <asp:Panel runat="server" CssClass="BlogContent">
                        <div style="margin-bottom: 15px;">
                            <h2><asp:Label runat="server" CssClass="BlogTitle" Text='<%# Eval("title_txt") %>' /></h2>
                            <h3><asp:Label runat="server" CssClass="BlogSubtitle" Visible='<%# !string.IsNullOrEmpty(string.Format("{0}", Eval("subtitle_txt"))) %>' Text='<%# string.Format("{0}<br/>", Eval("subtitle_txt")) %>' /></h3>
                        </div>
                        <div style="clear: both;">
                            <%# Eval("content_txt") %>
                        </div>
                        <div style="clear: both; margin: 10px 0px; color: #666;">
                            Posted by <%# Eval("UserName") %> on <%# Eval("create_dttm", "{0:dddd, MMMM d, yyyy}") %>.
                        </div>
                    </asp:Panel>
                </div>
            </ItemTemplate>
            <SeparatorTemplate>
                <hr />
            </SeparatorTemplate>
            <FooterTemplate>
                <div style="float: left"><asp:LinkButton runat="server" ID="btNewerPost" OnClick="btNewerPost_Click" OnPreRender="btNewerPost_PreRender"><asp:Image runat="server" ImageUrl="~/Images/btn-arrow-up.gif" ImageAlign="AbsMiddle" style="float: left" />&nbsp;Newer posts</asp:LinkButton></div>
                <div style="float: left"><asp:LinkButton runat="server" ID="btOlderPost" OnClick="btOlderPost_Click" OnPreRender="btOlderPost_PreRender"><asp:Image runat="server" ImageUrl="~/Images/btn-arrow-down.gif" ImageAlign="AbsMiddle" style="float: left" />&nbsp;Older posts</asp:LinkButton></div>
            </FooterTemplate>
        </asp:Repeater>
    </article>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="Window1" runat="server" Behaviors="Close, Move" VisibleStatusbar="False" />
        </Windows>
    </telerik:RadWindowManager>
</asp:Content>
